ExtensibleData.js ➔ describe(ꞌExtensibleDataꞌ)   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 30
rs 8.8571

2 Functions

Rating   Name   Duplication   Size   Complexity  
A ExtensibleData.js ➔ ... ➔ it(ꞌCreate with JSONꞌ) 0 14 1
A ExtensibleData.js ➔ ... ➔ it(ꞌtoJSON()ꞌ) 0 11 1
1
var assert = require('chai').assert,
2
    GedcomX = require('../../');
3
4
describe('ExtensibleData', function(){
5
6
  it('Create with JSON', function(){
7
    var ed = GedcomX.ExtensibleData({ 
8
      id: 'edid',
9
      links: {
10
        person: {
11
          href: '/person'
12
        }
13
      }
14
    });
15
    assert.equal(ed.getId(), 'edid', 'ID not saved properly when created with JSON');
16
    assert.equal(ed.getLinks().length, 1);
17
    assert.equal(ed.getLinks()[0].getHref(), '/person');
18
    assert.equal(ed.getLink('person').getHref(), '/person');
19
  });
20
  
21
  it('toJSON()', function(){
22
    var json = { 
23
      id: 'edid',
24
      links: {
25
        person: {
26
          href: '/person'
27
        }
28
      }
29
    }, ed = GedcomX.ExtensibleData(json);
30
    assert.deepEqual(ed.toJSON(), json, 'JSON export is incorrect');
31
  });
32
  
33
});